ggtitle("Scientific Community")
harm3_plot
# Descriptive stats table (Appendix) ####
library(htmlTable)
library(xtable)
a <- as.data.frame(prop.table(table(dat$Q78)))
b <- as.data.frame(prop.table(table(dat$Q79)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$Q76)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis")
library(tidyverse)
library(gridExtra)
## read in data ##### (skip first row)
dat <- (read.csv("2019-2020 All Member Survey.csv",stringsAsFactors = FALSE)[-1,])
dat <- subset(dat, ethics_consent=="Yes")
a <- as.data.frame(prop.table(table(dat$Q78)))
View(a)
b <- as.data.frame(prop.table(table(dat$Q79)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$Q76)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
demos <- txtRound(demos, 1)
print(xtable(demos),include.rownames = FALSE)
View(demos)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# packages ####
library(tidyverse)
library(gridExtra)
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# packages ####
library(tidyverse)
library(gridExtra)
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
## convert to numeric
## variables rank_ethics (7th) through harm_science_labexp (33rd)
dat_num <- as.data.frame(dat[,7:33] <-
lapply(dat[,7:33,drop=FALSE],as.numeric))
dat_ranks <- dat_num %>%
rename(
Ethics=rank_ethics,
Writing=rank_writingquality,
Design=rank_designquality,
Analysis=rank_analysisquality,
Theory=rank_theory,
Results=rank_results
)
## reshape
dat_ranks <- dat_ranks %>% pivot_longer(Ethics:Results)
# order "name" (item) by mean "value" (rank)
(avgrank <-aggregate(value ~ name, dat_ranks, mean))
dat_ranks$name <-factor(dat_ranks$name, levels=avgrank[order(avgrank$value), "name"])
## plot evaluation rankings (Figure 1) ####
rank_plot <- ggplot(dat_ranks, aes(x=name,y=value)) +
stat_summary(fun.data= mean_cl_normal, fun.args = list(conf.int = 0.95)) + theme_bw() + xlab("") +
ylab("Less Important                         More Important") +
coord_cartesian(ylim=c(6, 1)) +
theme(axis.text=element_text(size=14),axis.title=element_text(size=14))+
scale_y_continuous(breaks = c(1:6))
rank_plot
## harm to subjects ####
dat_harm1 <- dat_num %>%
rename(
Audit=harm_subjects_audits,
Ethnography=harm_subjects_ethnog,
Field.Exp=harm_subjects_fieldexp,
Survey.Exp=harm_subjects_surveyexp,
Lab.Exp=harm_subjects_labexp,
Interviews=harm_subjects_interviews,
Observational=harm_subjects_observ
)
# reshape
dat_harm1 <- dat_harm1 %>% pivot_longer(Interviews:Lab.Exp)
# order "name" (item) by mean "value" (rank)
(avgharm1 <-aggregate(value ~ name, dat_harm1, mean))
dat_harm1$name <-factor(dat_harm1$name, levels=avgharm1[order(avgharm1$value), "name"])
### plot harm to subjects (left plot Figure 2) ####
harm1_plot <- ggplot(dat_harm1, aes(x=name,y=value)) +
stat_summary(fun.data= mean_cl_normal, fun.args = list(conf.int = 0.95)) + theme_bw() + xlab("") +
ylab("Less Harmful                         More Harmful") +
coord_cartesian(ylim=c(6, 1)) +
theme(axis.text.x = element_text(angle = 35, hjust = 1, size=11),axis.title=element_text(size=12),plot.title = element_text(size = 14)) +
scale_y_continuous(breaks=c(1:7)) +
ggtitle("Research Subjects")
harm1_plot
## harm to society ####
dat_harm2 <- dat_num %>%
rename(
Audit=harm_society_audits,
Ethnography=harm_society_ethnog,
Field.Exp=harm_society_fieldexp,
Survey.Exp=harm_society_surveyexp,
Lab.Exp=harm_society_labexp,
Interviews=harm_society_interviews,
Observational=harm_society_observ
)
# reshape
names(dat_harm2)
dat_harm2 <- dat_harm2 %>% pivot_longer(Interviews:Lab.Exp)
# keep order from first plot
(avgharm2 <-aggregate(value ~ name, dat_harm2, mean))
dat_harm2$name <-factor(dat_harm2$name, levels=avgharm1[order(avgharm1$value), "name"])
### plot harm to society (middle plot Figure 2) ####
harm2_plot <- ggplot(dat_harm2, aes(x=name,y=value)) +
stat_summary(fun.data= mean_cl_normal, fun.args = list(conf.int = 0.95)) + theme_bw() + xlab("") +ylab("") +
coord_cartesian(ylim=c(6, 1)) +
theme(axis.text.x = element_text(angle = 35, hjust = 1, size=11),axis.title=element_text(size=12),plot.title = element_text(size = 14)) +
scale_y_continuous(breaks = c(1:7)) +
ggtitle("Society")
harm2_plot
## harm to scientic community ####
dat_harm3 <- dat_num %>%
rename(
Audit=harm_science_audits,
Ethnography=harm_science_ethnog,
Field.Exp=harm_science_fieldexp,
Survey.Exp=harm_science_surveyexp,
Lab.Exp=harm_science_labexp,
Interviews=harm_science_interviews,
Observational=harm_science_observ
)
# reshape
names(dat_harm3)
dat_harm3 <- dat_harm3 %>% pivot_longer(Interviews:Lab.Exp)
# keep order from first plot
(avgharm3 <-aggregate(value ~ name, dat_harm3, mean))
dat_harm3$name <-factor(dat_harm3$name, levels=avgharm1[order(avgharm1$value), "name"])
### plot harm to scientific community (right plot Figure 2) ####
harm3_plot <- ggplot(dat_harm2, aes(x=name,y=value)) +
stat_summary(fun.data= mean_cl_normal, fun.args = list(conf.int = 0.95)) + theme_bw() + xlab("") +ylab("") +
coord_cartesian(ylim=c(6, 1)) +
theme(axis.text.x = element_text(angle = 35, hjust = 1, size=11),axis.title=element_text(size=12),plot.title = element_text(size = 14)) +
scale_y_continuous(breaks = c(1:7)) +
ggtitle("Scientific Community")
harm3_plot
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# packages ####
library(tidyverse)
# read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="ResponseId")
# packages ####
library(cjoint)
# read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="ResponseId")
# read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
# read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis")
library(cjoint)
## read in conjoint data #####
dat <- read.qualtrics("2019-2020 All Member Survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"), covariates=c("ethics_consent", "worksonethics", "subfield", "methods_casestudies", "methods_observ", "methods_surveyexp", "methods_labexp", "methods_fieldexp", "methods_audits", "methods_interp","methods_archiv","methods_content","methods_interviews","methods_ethnog", "twitteruse"),
respondentID="ResponseId")
View(dat)
# packages ####
library(tidyverse)
library(gridExtra)
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis")
# packages ####
library(cjoint)
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("2019-2020 All Member Survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"), covariates=c("ethics_consent", "worksonethics", "subfield", "methods_casestudies", "methods_observ", "methods_surveyexp", "methods_labexp", "methods_fieldexp", "methods_audits", "methods_interp","methods_archiv","methods_content","methods_interviews","methods_ethnog", "twitteruse"),
respondentID="ResponseId")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("2019-2020 All Member Survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"), covariates=c("subfield"),
respondentID="ResponseId")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("2019-2020 All Member Survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="ResponseId")
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# packages ####
library(cjoint)
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="ResponseId")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey_conjoint.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey_conjoint.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
dat <- read.csv("ethics_apsa_survey_conjoint.csv")
table)(dat$ethics_consent)
table(dat$ethics_consent)
dat <- subset(dat, ethics_consent=="Yes" | ethics_consent=="Do you agree to participate in the study?")
write.csv(dat, "ethics_apsa_survey.csv")
dat <- read.csv("ethics_apsa_survey.csv")
View(dat)
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
View(dat)
View(dat)
View(dat)
# DESCRIPTIVE STATS OF SAMPLE (Appendix) ####
library(htmlTable)
library(xtable)
a <- as.data.frame(prop.table(table(dat$Q78)))
b <- as.data.frame(prop.table(table(dat$Q79)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$Q76)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
demos <- txtRound(demos, 1)
print(xtable(demos),include.rownames = FALSE)
View(demos)
a <- as.data.frame(prop.table(table(dat$position1)))
b <- as.data.frame(prop.table(table(dat$position2)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
demos <- txtRound(demos, 1)
a <- as.data.frame(prop.table(table(dat$position1)))
b <- as.data.frame(prop.table(table(dat$position2)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
colnames(demos) <- c(" ", "Percent of Sample (%)")
demos <- txtRound(demos, 1)
a <- as.data.frame(prop.table(table(dat$position1)))
b <- as.data.frame(prop.table(table(dat$position2)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c, d)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
#demos <- txtRound(demos, 1)
print(xtable(demos),include.rownames = FALSE)
View(demos)
a <- as.data.frame(prop.table(table(dat$position1)))
b <- as.data.frame(prop.table(table(dat$position2)))
c <- as.data.frame(prop.table(table(dat$subfield)))
d <- as.data.frame(prop.table(table(dat$gender)))
View(a)
View(b)
View(b)
View(c)
a <- as.data.frame(prop.table(table(dat$position1)))
View(a)
a <- as.data.frame(prop.table(table(dat$position2)))
b <- as.data.frame(prop.table(table(dat$subfield)))
c <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c)
View(demos)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
dat <- read.csv("ethics_apsa_survey.csv")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
a <- as.data.frame(prop.table(table(dat$position2)))
b <- as.data.frame(prop.table(table(dat$subfield)))
c <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
View(demos)
# DESCRIPTIVE STATS OF SAMPLE (Appendix) ####
library(sjPlot)
a <- as.data.frame(prop.table(table(dat$position2)))
b <- as.data.frame(prop.table(table(dat$subfield)))
c <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
#demos <- txtRound(demos, 1)
tab_df(demos, file="survey_demos.doc")
# packages ####
library(tidyverse)
library(gridExtra)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
names(dat)
# DESCRIPTIVE STATS OF SAMPLE (Appendix) ####
library(sjPlot)
a <- as.data.frame(prop.table(table(dat$position2)))
# packages ####
library(tidyverse)
library(gridExtra)
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# read in data #####
# (skip first row which provides question labels)
dat <- (read.csv("ethics_apsa_survey.csv")[-1,])
# DESCRIPTIVE STATS OF SAMPLE (Appendix) ####
library(sjPlot)
a <- as.data.frame(prop.table(table(dat$position2)))
b <- as.data.frame(prop.table(table(dat$subfield)))
c <- as.data.frame(prop.table(table(dat$gender)))
demos <- rbind(a, b, c)
demos <- demos[demos$Var1 != "", ]
demos$Freq <- demos$Freq*100
colnames(demos) <- c(" ", "Percent of Sample (%)")
#demos <- txtRound(demos, 1)
tab_df(demos, file="survey_demos.doc")
setwd("~/Dropbox/ethics_audit_studies/APSA survey - data and analysis/replication files")
# packages ####
library(cjoint)
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey_conjoint.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
# read in conjoint data #####
## read in conjoint data #####
dat <- read.qualtrics("ethics_apsa_survey.csv",
responses=c("task1choice", "task2choice", "task3choice", "task4choice", "task5choice"),
respondentID="respondent")
View(dat)
# how many choice outcomes
table(dat$selected)
## author affiliation ####
table(dat$Author.affiliation)
dat$Affiliation <- NA
dat$Affiliation[dat$Author.affiliation=="Columbia University" | dat$Author.affiliation=="Princeton University" | dat$Author.affiliation=="Stanford University" | dat$Author.affiliation=="UC-San Diego" | dat$Author.affiliation=="UC-Davis" ] <- "Top 20 Research Univ."
dat$Affiliation[dat$Author.affiliation=="Amherst College" | dat$Author.affiliation=="Middlebury College" | dat$Author.affiliation=="Oberlin College"] <- "SLAC"
dat$Affiliation[dat$Author.affiliation=="Florida State University"| dat$Author.affiliation=="University of Georgia"| dat$Author.affiliation=="Boston University"| dat$Author.affiliation=="University of Kansas"| dat$Author.affiliation=="University of Connecticut"] <- "Other R1 Univ."
dat$Affiliation[dat$Author.affiliation=="Providence College" | dat$Author.affiliation=="Fairfield University" | dat$Author.affiliation=="Fordham University"| dat$Author.affiliation=="Clark University"| dat$Author.affiliation=="Missouri State University"| dat$Author.affiliation=="Western Michigan University"] <- "Unranked Research Univ."
dat$Affiliation[dat$Author.affiliation=="London School of Economics" | dat$Author.affiliation=="Aarhus University" | dat$Author.affiliation=="University of Kent"]<- "European Research Univ."
table(dat$Affiliation)
sum(is.na(dat$Affiliation))
## journal ##
table(dat$Publication.outlet)
## journal ####
table(dat$Publication.outlet)
dat$Outlet <- NA
dat$Outlet[dat$Publication.outlet=="American Journal of Political Science" | dat$Publication.outlet=="American Political Science Review" | dat$Publication.outlet=="Journal of Politics"] <- "Top 3 Journal"
dat$Outlet[dat$Publication.outlet=="Political Behavior" | dat$Publication.outlet=="Comparative Political Studies" | dat$Publication.outlet=="Electoral Studies"] <- "Subfield Journal"
dat$Outlet[dat$Publication.outlet=="Political Science Review" ] <- "Political Science Review (fake)"
dat$Outlet[dat$Publication.outlet=="Science" ] <- "Science"
dat$Outlet[dat$Publication.outlet=="Political Research Quarterly" | dat$Publication.outlet=="Political Science Research and Methods"| dat$Publication.outlet=="Quarterly Journal of Political Science"| dat$Publication.outlet=="Research and Politics" | dat$Publication.outlet=="Social Science Quarterly" | dat$Publication.outlet=="The Forum"] <- "Other General Journal"
dat$Outlet[dat$Publication.outlet=="Working paper (unpublished)"] <- "Working paper (unpublished)"
table(dat$Outlet)
sum(is.na(dat$Outlet))
## conclusions ####
dat$Conclusion <- NA
dat$Conclusion[dat$Conclusions=="Elected officials were found to be biased against minorities."] <- "Bias against minorities"
dat$Conclusion[dat$Conclusions=="Elected officials were found to be biased towards minorities and against members of the majority group."] <- "Bias against majorities"
dat$Conclusion[dat$Conclusions=="No evidence of bias by elected officials in either direction was found."] <- "No bias"
# relevel baselines ####
dat$Author <- as.factor(dat$Author.rank)
dat$Location <- as.factor(dat$Location.of.study)
dat$Sample <- as.factor(dat$Sample.size)
dat$Method <- as.factor(dat$Study.type)
dat$Affiliation <- as.factor(dat$Affiliation)
dat$Outlet <- as.factor(dat$Outlet)
dat$Conclusion <- as.factor(dat$Conclusion)
dat$Author <- relevel(dat$Author, ref="Full Professor")
dat$Conclusion <- relevel(dat$Conclusion, ref="No bias")
dat$Location <- relevel(dat$Location, ref="United States")
dat$Sample <- relevel(dat$Sample, ref="200")
dat$Method <- relevel(dat$Method, ref="Observational")
dat$Affiliation <- relevel(dat$Affiliation, ref="Top 20 Research Univ.")
dat$Outlet <- relevel(dat$Outlet, ref="Top 3 Journal")
### main effects: AMCEs ####
f1 <- selected ~ Affiliation + Author + Conclusion + Location + Outlet + Sample + Method
amces <- cj(dat, f1, id=~Response.ID)
amces
# drop unused factor levels #
dat <- droplevels(dat)
# cregg
detach(package:cjoint)
library(cregg)
### main effects: AMCEs ####
f1 <- selected ~ Affiliation + Author + Conclusion + Location + Outlet + Sample + Method
amces <- cj(dat, f1, id=~Response.ID)
amces <- cj(dat, f1, id=~respondent)
amces
amces_plot <- plot(amces,
feature_headers = FALSE,
vline=0, feature_labels=FALSE,
size=2) +
ggplot2::facet_wrap(~feature, ncol = 2L,scales = "free_y", strip.position = "top") +
xlab("Average Marginal Component Effect")+
theme_minimal() +
theme(axis.text=element_text(size=11),axis.title=element_text(size=14), strip.text = element_text(size = 11), legend.position="none") +
scale_colour_manual(values = c("black", "black","black","black","black","black","black")) +
scale_shape_manual(values = c(1,2,5,7,13,10,9)) +
aes(shape = feature)
amces_plot
mms <- cj(dat, f1, id=~Response.ID, estimate="mm")
mms <- cj(dat, f1, id=~respondent, estimate="mm")
mms
mm_plot <- plot(mms,
feature_headers = FALSE,
vline=0.5, feature_labels=TRUE,
size=2) +
ggplot2::facet_wrap(~feature, ncol = 2L,scales = "free_y", strip.position = "top") +
xlab("Marginal Mean")+
theme_minimal() +
theme(axis.text=element_text(size=11),axis.title=element_text(size=14), strip.text = element_text(size = 11), legend.position="none")+
scale_colour_manual(values = c("black", "black","black","black","black","black","black")) +
scale_shape_manual(values = c(1,2,5,7,13,10,9)) +
aes(shape = feature)
mms
mm_plot
dat$Affiliation2 <- dat$Author.affiliation
f2 <- selected ~ Affiliation2 + Author + Conclusion + Location + Outlet + Sample + Method
amces_affil <- cj(dat, f2, feature_labels = list(Affiliation2 = "Affiliation"), id=~Response.ID)
dat$Affiliation2 <- dat$Author.affiliation
f2 <- selected ~ Affiliation2 + Author + Conclusion + Location + Outlet + Sample + Method
amces_affil <- cj(dat, f2, feature_labels = list(Affiliation2 = "Affiliation"), id=~respondent)
amces_affil
plot_affil <- plot(subset(amces_affil, feature=="Affiliation"),
feature_headers = FALSE,
vline=0, feature_labels=FALSE,
size=2) +
ggplot2::facet_wrap(~feature,scales = "free_y", strip.position = "top") +
xlab("Average Marginal Component Effect")+
theme_minimal() +
theme(axis.text=element_text(size=10),axis.title=element_text(size=14), strip.text = element_text(size = 14), legend.position="none") +
scale_colour_manual(values = c("black")) +
scale_shape_manual(values = c(1)) +
aes(shape = feature)
plot_affil
dat$Outlet2 <- as.character(dat$Publication.outlet)
table(dat$Outlet2)
dat$Outlet2[dat$Outlet2=="Political Science Review"] <- "Political Science Review (fake)"
# it does not like the word "methods" in this level
dat$Outlet2[dat$Outlet2=="Political Science Research and Methods"] <- "Political Science Research and Meth."
dat$Outlet2 <- as.factor(dat$Outlet2)
table(dat$Outlet2)
f3 <- selected ~ Outlet2 + Affiliation + Author + Conclusion + Location + Sample + Method
amces_outlet <- cj(dat, f3, feature_labels = list(Outlet2 = "Outlet"))
amces_outlet
plot_outlet <- plot(subset(amces_outlet, feature=="Outlet"),
feature_headers = FALSE,
vline=0, feature_labels=FALSE,
size=2) +
ggplot2::facet_wrap(~feature,scales = "free_y", strip.position = "top") +
xlab("Average Marginal Component Effect")+
theme_minimal() +
theme(axis.text=element_text(size=10),axis.title=element_text(size=14), strip.text = element_text(size = 14), legend.position="none") +
scale_colour_manual(values = c("black")) +
scale_shape_manual(values = c(13)) +
aes(shape = feature)
plot_outlet
